/*LICENSE_BEGIN
 * ******************************************************************
 * Copyright 2006 by the Dainamite Robocup-Team at the
 * DAI-Labor, TU-Berlin (www.dai-labor.de)
 * 
 * Members of Dainamite are:
 * Holger Endert
 * Robert Wetzker
 * Thomas Karbe
 * Axel Heßler
 * Philippe Bütter
 * Felix Brossmann
 * 
 * Licensed under the GNU GPL (General Public License) Free Software 
 * License, Version 2. You may use this file only in compliance with 
 * the License. You may obtain a copy of the License at:
 * 
 * http://www.fsf.org/licensing/licenses/gpl.txt
 * ******************************************************************
LICENSE_END*/
package robocup.component.infotypes;

import robocup.component.geometry.Vektor;
import robocup.component.worldobjects.Player;

/**
 * The Player how it is seen by the coach. The speed and position are
 * not noisy, and were directly given by the server.
 */
public class CoachPlayerInfo extends CoachVisualObjectInfo {

	/**
	 * The teamName of the corresponding player.
	 */
	protected String teamName;

	/**
	 * The tricot-number of the player.
	 */
	protected int playerNumber;

	/**
	 * The speed in x-direction.
	 */
	protected double xSpeed;

	/**
	 * The speed in y-direction.
	 */
	protected double ySpeed;

	/**
	 * The players body direction.
	 */
	protected double bodyAngle;

	/**
	 * The players neck-angle.
	 */
	protected double neckAngle;

	/**
	 * The players pointing direction.
	 */
	protected double pointDirection;

	/**
	 * Flag, that indicates, that the player has tackled lately,
	 * and is therefore not able to move.
	 */
	protected boolean tackle;

	/**
	 * Identifier for the goalie.
	 */
	protected boolean goalie;

	/**
	 * Constructs an info-object of a seen player for the coach
	 * 
	 * @param team -
	 *            his team-name
	 * @param iCycle -
	 *            when the agent was seen
	 * @param xPos -
	 *            his position (x-value)
	 * @param yPos -
	 *            his position (y-value)
	 * @param xSpeed -
	 *            his speed (in x-direction)
	 * @param ySpeed -
	 *            his speed (in y-direction)
	 * @param playerNumber -
	 *            his player number
	 * @param bodyAngle -
	 *            his body angle
	 * @param neckAngle -
	 *            his neck-angle
	 * @param pointDirection -
	 *            the direction he is pointing to
	 * @param goalie -
	 *            wether he is a goalie or not
	 * @param tackle -
	 *            wether he has tackled or not
	 */
	public CoachPlayerInfo(String team, int iCycle, double xPos, double yPos,
			double xSpeed, double ySpeed, int playerNumber, double bodyAngle,
			double neckAngle, double pointDirection, boolean goalie,
			boolean tackle) {
		super(iCycle, xPos, yPos);
		this.teamName = team;
		this.playerNumber = playerNumber;
		this.xSpeed = xSpeed;
		this.ySpeed = ySpeed;
		this.bodyAngle = bodyAngle;
		this.neckAngle = neckAngle;
		this.pointDirection = pointDirection;
		this.goalie = goalie;
		this.tackle = tackle;
	}

	/**
	 * Sets the seen body-angle.
	 * @param bodyAngle
	 */
	public void setBodyAngle(double bodyAngle) {
		this.bodyAngle = bodyAngle;
	}

	/**
	 * Sets the seen neck-angle.
	 * @param nackAngle
	 */
	public void setNeckAngle(double neckAngle) {
		this.neckAngle = neckAngle;
	}

	/**
	 * Sets the seen playerNumber.
	 * @param playerNumber
	 */
	public void setPlayerNumber(int playerNumber) {
		this.playerNumber = playerNumber;
	}

	/**
	 * Sets the seen pointDirection
	 * @param pointDirection
	 */
	public void setPointDirection(double pointDirection) {
		this.pointDirection = pointDirection;
	}

	/**
	 * Sets the seen tackle-flag.
	 * @param tackle
	 */
	public void setTackle(boolean tackle) {
		this.tackle = tackle;
	}

	/**
	 * Sets the seen x-component of the speed.
	 * @param speed
	 */
	public void setXSpeed(double speed) {
		this.xSpeed = speed;
	}

	/**
	 * Sets the seen y-component of the speed.
	 * @param speed
	 */
	public void setYSpeed(double speed) {
		this.ySpeed = speed;
	}

	/**
	 * @return Returns the bodyAngle.
	 */
	public double getBodyAngle() {
		return this.bodyAngle;
	}

	/**
	 * @return Returns the neckAngle.
	 */
	public double getNeckAngle() {
		return this.neckAngle;
	}

	/**
	 * @return Returns the playerNumber.
	 */
	public int getPlayerNumber() {
		return this.playerNumber;
	}

	/**
	 * @return Returns the pointDirection.
	 */
	public double getPointDirection() {
		return this.pointDirection;
	}

	/**
	 * @return Returns the tackle.
	 */
	public boolean isTackle() {
		return this.tackle;
	}

	/**
	 * @return Returns the xSpeed.
	 */
	public double getXSpeed() {
		return this.xSpeed;
	}

	/**
	 * @return Returns the ySpeed.
	 */
	public double getYSpeed() {
		return this.ySpeed;
	}

	/**
	 * @return Returns true, if the player was seen as goalie.
	 */
	public boolean isGoalie() {
		return this.goalie;
	}

	/**
	 * Sets the flag, that the player was seen as goalie.
	 * @param goalie
	 */
	public void setGoalie(boolean goalie) {
		this.goalie = goalie;
	}

	/**
	 * @return Returns the team-name of the seen player.
	 */
	public String getTeamName() {
		return this.teamName;
	}

	/**
	 * Sets the teamname of the seen player.
	 * @param teamName
	 */
	public void setTeamName(String teamName) {
		this.teamName = teamName;
	}

	/**
	 * Creates and returns an instance of the class player, which corresponds
	 * to the seen information.
	 * 
	 * @return Player - a player object craeted due to the seen information.
	 */
	public Player getPlayer() {
		Player p = new Player(this.getCycle(), this.getCycle(), this
				.getPlayerNumber(), new Vektor(Vektor.XY, this.getXPos(), this
				.getYPos()), new Vektor(Vektor.XY, this.getXSpeed(), this
				.getYSpeed()), this.getBodyAngle(), this.getNeckAngle(), 0, 0,
				0, false, false, // not known here
				this.isGoalie(), null);
		return p;
	}
}
